<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderBatchesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('order_batches', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id');
            $table->unsignedBigInteger('session_id');
            $table->integer('order_count')->default(0)->comment('当前批次订单数');
            $table->integer('cumulative_orders')->default(0)->comment('累计下单');
            $table->integer('success_count')->default(0)->comment('成功数');
            $table->integer('failure_count')->default(0)->comment('失败数');
            $table->integer('advance_card')->default(0)->comment('垫付卡');
            $table->decimal('payment_bean', 8, 2)->default(0)->comment('支付通证');
            $table->decimal('payment_balance', 8, 2)->default(0)->comment('支付余额');
            $table->decimal('bean_unit_price', 8, 2)->default(0)->comment('通证单笔支付');
            $table->decimal('balance_unit_price', 8, 2)->default(0)->comment('余额单笔支付');
            $table->decimal('reward_contribution', 8, 2)->default(0)->comment('奖励贡献值');
            $table->decimal('point_burning_reward', 8, 2)->default(0)->comment('积分燃烧奖励');
            $table->decimal('bean_burning_reward', 8, 2)->default(0)->comment('通证燃烧奖励');
            $table->tinyInteger('status')->default(0)->comment('状态');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('order_batches');
    }
}
